package com.ayuku.course.ui.employee;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DateTime;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;

public class CompPegawai extends Composite {

	private Text txtKode;
	private Text txtName;
	private Text txtPhone;
	private Text txtAlamat;
	private Text txtLevel;
	private Text txtPassword;
	private DateTime dateTime;

	/**
	 * Create the composite.
	 * 
	 * @param parent
	 * @param style
	 */
	public CompPegawai(Composite parent, int style) {
		super(parent, SWT.NONE);
	
		GridLayout gridLayout = new GridLayout(2, false);
		gridLayout.marginWidth = 6;
		setLayout(gridLayout);

		Label lbl1 = new Label(this, SWT.NONE);
		lbl1.setText("Kode");

		txtKode = new Text(this, SWT.BORDER);
		txtKode.setTextLimit(10);
		txtKode.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false,
				1, 1));

		Label lb2 = new Label(this, SWT.NONE);
		lb2.setText("Nama");

		txtName = new Text(this, SWT.BORDER);
		txtName.setTextLimit(30);
		txtName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false,
				1, 1));

		Label lb3 = new Label(this, SWT.NONE);
		lb3.setText("Phone");

		txtPhone = new Text(this, SWT.BORDER);
		txtPhone.setTextLimit(30);
		txtPhone.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false,
				1, 1));

		Label lb5 = new Label(this, SWT.NONE);
		lb5.setText("Level");

		txtLevel = new Text(this, SWT.BORDER);
		txtLevel.setTextLimit(10);
		txtLevel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false,
				1, 1));
		
		Label lb6 = new Label(this, SWT.NONE);
		lb6.setText("Email");
		
		txtEmail = new Text(this, SWT.BORDER);
		txtEmail.setTextLimit(30);
		txtEmail.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));

		Label lb7 = new Label(this, SWT.NONE);
		lb7.setText("Password");

		txtPassword = new Text(this, SWT.BORDER | SWT.PASSWORD);
		txtPassword.setTextLimit(10);
		txtPassword.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false,
				false, 1, 1));

		Label lb8 = new Label(this, SWT.NONE);
		lb8.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false,
				false, 1, 1));
		lb8.setText("Join Date");

		dateTime = new DateTime(this, SWT.BORDER | SWT.DROP_DOWN);
		dateTime.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent arg0) {
				dateHasSelected(arg0);
			}
		});
		dateTime.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
		
				Label lb4 = new Label(this, SWT.NONE);
				lb4.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
				lb4.setText("Alamat");
		
				txtAlamat = new Text(this, SWT.BORDER | SWT.WRAP | SWT.MULTI);
				txtAlamat.setTextLimit(100);
				GridData gd_txtAlamat = new GridData(SWT.FILL, SWT.FILL, false, false,
						1, 1);
				gd_txtAlamat.heightHint = 68;
				txtAlamat.setLayoutData(gd_txtAlamat);

	}

	int dateSelected = 0;
	private Text txtEmail;
	protected void dateHasSelected(SelectionEvent arg0) {
		dateSelected = 1;
	}

	public int getDateSelected() {
		return dateSelected;
	}

	public void setDateSelected(int dateSelected) {
		this.dateSelected = dateSelected;
	}

	public Text getTxtKode() {
		return txtKode;
	}

	public void setTxtKode(Text txtKode) {
		this.txtKode = txtKode;
	}

	public Text getTxtName() {
		return txtName;
	}

	public void setTxtName(Text txtNama) {
		this.txtName = txtNama;
	}

	public Text getTxtPhone() {
		return txtPhone;
	}

	public void setTxtPhone(Text txtPhone) {
		this.txtPhone = txtPhone;
	}

	public Text getTxtAlamat() {
		return txtAlamat;
	}

	public void setTxtAlamat(Text txtAlamat) {
		this.txtAlamat = txtAlamat;
	}

	public Text getTxtLevel() {
		return txtLevel;
	}

	public void setTxtLevel(Text txtLevel) {
		this.txtLevel = txtLevel;
	}

	public Text getTxtPassword() {
		return txtPassword;
	}

	public void setTxtPassword(Text txtPassword) {
		this.txtPassword = txtPassword;
	}

	public DateTime getDateTime() {
		return dateTime;
	}

	public void setDateTime(DateTime dateTime) {
		this.dateTime = dateTime;
	}

	@Override
	protected void checkSubclass() {
		// Disable the check that prevents subclassing of SWT components
	}

	public Text getTxtEmail() {
		return txtEmail;
	}

	public void setTxtEmail(Text txtEmail) {
		this.txtEmail = txtEmail;
	}

}
